package com.itheima.d4_byte__stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;

public class CopyTest5 {

    public static void main(String[] args) throws Exception {

        //需求复制照片
        //创建字节输入流管道与源文件接通
        InputStream is = new FileInputStream("D:\\Java\\JavaEE_learn\\IO_learn\\src\\main\\java\\com\\itheima\\itheima04out.txt");
        //创建字节输出流管道和目标文件接通
        FileOutputStream os = new FileOutputStream("D:\\Java\\JavaEE_learn\\IO_learn\\src\\main\\java\\com\\itheima\\itheima04outCopy.tx");

        //接收所有的字节输入流
//        byte[] bytes = is.readAllBytes();
        byte[] bytes = new byte[1024];
        int len;
        if((len =is.read(bytes)) != -1){
            os.write(bytes,0,len);
        }

//        os.write(bytes);
        os.close();
        is.close();
        System.out.println("复制完成·");
    }

}
